import Vue from 'vue'
import VueRouter from 'vue-router'
import Main from '../components/Main.vue'
// system
import SignIn from '../components/system/SignIn.vue'
import SignUp from '../components/system/SignUp.vue'
import InfoList from '../components/system/InfoList.vue'
// document
import List from '../components/document/List.vue'
import ViewMD from '../components/document/ViewMD.vue'
import EditMD from '../components/document/EditMD.vue'
import Luckysheet from '../components/document/Lysheet.vue'
import ViewPic from '../components/document/ViewPic.vue'
import OtherPage from '../views/OtherPage.vue'
// Job
import Job from '../components/sheduler/ShedulerConfig.vue'
// task
import Tasks from '../components/task/Tasks.vue'
import Summary from '../components/task/Summary.vue'
import PersonList from '../components/task/PersonList.vue'
import ModifyList from '../components/task/ModifyList.vue'
import JiraList from '../components/task/JiraList.vue'
import KeyConfig from '../components/task/TaskConfig.vue'
import GroupInfo from '../components/task/GroupInfo.vue'
import TaskSubtotal from '../components/task/TaskSubtotal.vue'
// Scene
import Scene from '../components/Scene/Scenes'
import Design from '../components/Scene/old/design'
import SceneList from '../components/Scene/ScenseList'
// views
import Navbar from '../views/Navbar'

// 路由配置，若已在该页面，点击该调整进入该页面的头部连接后不报错
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Main',
    component: Main,
    meta:{
        // 页面标题title
        title: 'WorkingPlaForm'
    },
    children: [
      {
        path: '/Login',
        name: 'Login',
        component: SignIn
      },
      {
        path: '/Logout',
        name: 'Logout',
        component: SignUp
      },
      {
        path: '/Home',
        name: 'Home',
        component: InfoList,
        meta:{
            // 页面标题title
            title: '工作平台-首页'
        },
      },
      {
        path: '/Job',
        name: 'Job',
        component: Job,
        meta:{
            // 页面标题title
            title: '工作平台-定时任务'
        },
      },
      {
        path: '/Task',
        name: 'Task',
        component: Tasks,
        meta:{
            // 页面标题title
            title: '工作平台-Task'
        },
        children: [
          {
            path: '/Task/Summary',
            name: 'Summary',
            component: Summary,
            meta:{
                // 页面标题title
                title: '工作平台-待办任务'
            },
          },
          {
            path: '/Task/PersonTask',
            name: 'PersonTask',
            component: PersonList,
          },
          {
            path: '/Task/TsTask',
            name: 'TsTask',
            component: ModifyList,
          },
          {
            path: '/Task/JiraTask',
            name: 'JiraTask',
            component: JiraList,
          },
          {
            path: '/Task/GroupInfo',
            name: 'GroupInfo',
            component: GroupInfo
          },
          {
            path: '/Task/Config',
            name: 'KeyConfig',
            component: KeyConfig
          },
          {
            path: '/Task/Subtotal',
            name: 'TaskSubtotal',
            component: TaskSubtotal
          }
        ]
      },
      {
        path: '/Document',
        name: 'List',
        component: List,
        meta:{
            // 页面标题title
            title: '工作平台-知识库'
        },
        children: [
          {
            path: '/Document/ViewMD/:name',
            name: 'ViewMD',
            component: ViewMD
          },
          {
            path: '/Document/EditMD/:name',
            name: 'EditMD',
            component: EditMD
          },
          {
            path: '/Document/Luckysheet/:name/:common',
            name: 'Luckysheet',
            component: Luckysheet
          },
          {
            path: '/Document/ViewPicture/:name',
            name: 'ViewPicture',
            component: ViewPic
          },
          {
            path: '/Document/OtherPage/:name',
            name: 'OtherPage',
            component: OtherPage
          }
        ]
      },
      {
        path: '/Scene',
        name: 'Scene',
        component: Scene,
        meta:{
            // 页面标题title
            title: '工作平台-测试场景'
        },
        children: [
          {
            path: '/Scene/Design/:name',
            name: 'Design',
            component: Design
          },
          {
            path: '/Scene/List/:name',
            name: 'SceneList',
            component: SceneList
          }
        ]
      },
      {
        path: '/Navbar',
        name: 'Navbar',
        component: Navbar
      }
    ]
  },
]

const router = new VueRouter({
  routes
})

export default router
